<template>
  <timeago2 :date-time="datetime" :pre-text="updated ? '修改于' : '回答于'" class="info" />
</template>

<script>
export default {
  name: 'answer-timeago',
  props: {
    item: Object,
  },
  computed: {
    createdTime() { return new Date(this.item.created_at).getTime(); },
    updatedTime() { return new Date(this.item.updated_at).getTime(); },
    datetime() { return Math.max(this.createdTime, this.updatedTime); },
    updated() { return this.updatedTime > this.createdTime; },
  },
};
</script>

<style></style>
